<?php

namespace SixShop\Balpay\Enum;

enum BalpayLogTypeEnum: int
{
    /**
     * 充值
     */
    case RECHARGE = 1;

    /**
     * 消费
     */
    case CONSUMTION = 2;

    /**
     * 退款
     */
    case REFUND = 3;

    /**
     * 冻结
     */
    case FREEZE = 4;

    /**
     * 解冻
     */
    case UNFREEZE = 5;
    /**
     * 提现
     */
    case WITHDRAWAL = 6;


    public function toString(): string
    {
        return match ($this) {
            self::RECHARGE => '充值',
            self::CONSUMTION => '消费',
            self::REFUND => '退款',
            self::FREEZE => '冻结',
            self::UNFREEZE => '解冻',
            self::WITHDRAWAL => '提现',
        };
    }

    public function negative(): bool
    {
        return match ($this) {
            self::CONSUMTION,
            self::FREEZE,
            self::WITHDRAWAL
            => true,
            default => false,
        };
    }
}
